﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GenericLibrariesToolKit;
using Utils;

namespace Model
{
    /// <summary>
    /// 团队实体
    /// </summary>
    public class Team
    {
        /*团队ID*/
        public string TeamId { get; set; }
        /*团队领导*/
        public string TeamLeader { get; set; }
        /*团队RFP编号*/
        public string TeamRFPId { get; set; }
        /*团队姓名*/
        public string TeamName { get; set; }
        /*团队描述*/
        public string TeamDescription { get; set; }
        /*团队成立日期*/
        private string teamDate = DateTimeUtil.GetDateTime();
        public string TeamDate
        {
            get { return teamDate; }
            set { teamDate = value; }
        }


        /// <summary>
        /// 应用程序启动时，实体管理器将会调用此方法进行初始化。
        /// </summary>
        public void Intialization()
        {
            //声明一个实体实体对象
            Entity entity = new Entity();

            //指定该实体对应数据库中的表名
            entity.TableName = "T_TEAM";
            //指定该实体的标识符
            entity.EntityId = "TeamId";
            //指定主键生成策略
            entity.Generator = GenericLibrariesToolKit.Enumeration.PKGenerationStrategy.GUID;
            ///实体关系映射字典
            ///key:实体属性名称，value:对应的数据库中表的字段名
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            dictionary.Add("TeamId", "TEAM_ID");
            dictionary.Add("TeamLeader", "TEAM_LEADER");
            dictionary.Add("TeamRFPId", "TEAM_RFP_ID");
            dictionary.Add("TeamName", "TEAM_NAME");
            dictionary.Add("TeamDescription", "TEAM_DESCRIPTION");
            dictionary.Add("TeamDate", "TEAM_DATE");

            //赋值
            entity.ORMDictionary = dictionary;

            //将实体加入实体管理器，
            EntityManager.GetInsatnce().AddEntity("Model.Team", entity);
        }
    }
}
